<?php
/**
 * submit.php - comment submit processing
 *
 * NMIT BIT Project - Infinity - A 3D Website using WebGL & HTML5 Technology
 * Infinity Grid Version 
 * Version: 0.1.2
 *
 * Author: William Liu <qzliuyuzou@gmail.com> <lyzdev@gmail.com>
 *
 * Required Server Version:
 *  PHP5 or higher
 *  MySQL 5 or higher
 *
 * Required Browser Version:
 *  Google Chrome 9 or higher
 *  Mozilla Firefox 4 Beta or higher
 *  *Apple Safari
 *
 * Copyright (c) 2011, William Liu All rights reserved.
 * Infinity is an open source 3D website project
 * Under Apache License 2.0
 * http://www.lyzsoft.cn
 * http://7cloud.wordpress.com
 *
 * Project Starting date: 9/13/2011
 * Update Date 1: 19/3/2011
 * Update Date 2: 5/6/2011 - Beta 2
 *
**/
define('INCLUDE_CHECK',1);
require_once('connection.php');
require_once('function.php');

header("Cache-Control: no-cache");

$txt=stripslashes($_POST['comment']);
//filter HTML tag and escape special characters
$txt = mysql_real_escape_string(strip_tags($txt),$db_connection); 
if(mb_strlen($txt) < 1 || mb_strlen($str) > 140)
    die("0");
$time = time();
$avatarID = rand(0,21);
$submitQuery=mysql_query("insert into msg(avatarID,content,addtime)values('$avatarID','$txt','$time')") or die (mysql_error());

if(mysql_affected_rows($db_connection)!=1)
    die("0");

echo formatSay($txt,$time,$avatarID);
?>
